import { executeInCurrentTab } from "~background/utils";

const highlightPage = (color, comments) => {
  function contentScriptHighlightPage(color, comments) {
    if (window.top !== window.self) return; // JM：iframe调用检查
    const result = window.highlighterAPI.highlightPage.create(color, comments);
    return result;
  }

  return executeInCurrentTab({ func: contentScriptHighlightPage, args: [color, comments] });
}

export default highlightPage;
